﻿using Microsoft.EntityFrameworkCore;
using MySqlStudent.UI.Models;

namespace MySqlStudent.UI.Infrastructure
{
    /// <summary>
    ///种子数据类
    /// </summary>
    public static class ModelBuilderExtensions
    {
        public static void Seed(this ModelBuilder modelBuilder)
        {
            // 为 student 实体添加种子数据
            modelBuilder.Entity<Student>().HasData(
                    new Student
                    {
                        Id = 5,
                        Name = "JackLovel2",
                        Marjor = MajorEnum.SecordGrade,
                        Email = "ww@qq.com"
                    }
                );
            modelBuilder.Entity<Student>().HasData(
                    new Student
                    {
                        Id = 7,
                        Name = "Kakao",
                        Marjor = MajorEnum.None,
                        Email = "kakao@qq.com"
                    }
                );
            modelBuilder.Entity<Student>().HasData(
                    new Student
                    {
                        Id = 8,
                        Name = "Kakao8",
                        Marjor = MajorEnum.None,
                        Email = "kakao8@qq.com"
                    }
                );

            modelBuilder.Entity<Student>().HasData(
                    new Student
                    {
                        Id = 9,
                        Name = "Kakao9",
                        Marjor = MajorEnum.SecordGrade,
                        Email = "kakao9@qq.com"
                    }
                );
        }
    }
}